
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>后台管理</title>
<link href="__PUBLIC__/ht/css/main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="__PUBLIC__/ht/js/jquery.js"></script>
<script type="text/javascript" src="__PUBLIC__/ht/js/action.js"></script>
</head>
<body>

<div class="aaa_pts_show_1">【 商家管理 】</div>

<div class="aaa_pts_show_2">
    
    <div>
       <div class="aaa_pts_4"><a href="{:U('shangchang/index')}">全部店铺</a></div>
       <div class="aaa_pts_4"><a href="{:U('shangchang/add')}">添加店铺</a></div>
    </div>
    <div class="aaa_pts_3">
      <form name='form' action="{:U('get_shop')}" method='get'>
      <div class="pro_4 bord_1">
         <div class="pro_5">商家名称：<input type="text" class="inp_1 inp_6" name="name" id="name" value="<?php echo $shop_name ?>"></div>
         <div class="pro_5">
               店铺级别：
               <select class="inp_1 inp_6" name="level" id="level">
			      <option value="">全部类别</option>
            <volist name="cate_list" id='cate'>
              <if condition="$cate.id eq $level">
              <option value="{$cate.id}" selected="selected">- {$cate.name}</option>
              <else />
              <option value="{$cate.id}">- {$cate.name}</option>
              </if>
				    </volist>
               </select>
         </div>
         
         <div class="pro_5">
               推荐店铺：
               <select class="inp_1 inp_6" name="tj" id="tuijian">
			      <option value="">全部店铺</option>
                  <option value="1" <?php echo $tj=='1' ? 'selected="selected"' : NULL ?>>推荐店铺</option>
                  <option value="2" <?php echo $tj=='2' ? 'selected="selected"' : NULL ?>>非推荐店铺</option>
	           </select>
         </div>
         
         <div class="pro_5">
               所在城市：
               <select class="inp_1 inp_3 inp_6" id="sheng" name="sheng" style="width:80px;" onchange="aaa_china_city_ajax(this.value,'city')">
			      <option value="">省份</option>
				    <volist name='sheng_list' id='prov'>
              <if condition="$prov.id eq $sheng">
              <option value="{$prov.id}" selected="selected">{$prov.name}</option>
              <else />
              <option value="{$prov.id}">{$prov.name}</option>
              </if>
            </volist>
               </select>
               <select class="inp_1 inp_6" id="city" name="city" style="width:80px;" onchange="aaa_china_city_ajax(this.value,'quyu')">
			      <option value="">城市</option>
                  
               </select>
               <select class="inp_1 inp_6"  id="quyu" name="quyu"  style="width:80px;">
			      <option value="">区</option>
                  
               </select>
         </div>
         
         <div class="pro_6"><input type="button" class="aaa_pts_web_3" value="搜 索" style="margin:0;" onclick="product_option(0);"></div>
      </div>
      </form>
      <table class="pro_3">
         <tr class="tr_1">
           <td style="width:40px;">ID</td>
           <td style="width:80px;">图片</td>
           <td>商家名称</td>
           <td style="width:100px;">店铺级别</td>
           <td style="width:180px;">负责人</td>
           <td style="width:180px;">所在地</td>
           <td style="width:100px;">推荐</td>
           <td style="width:260px;">操作</td>
         </tr>
         <tbody id="news_option">
         <!-- 遍历 -->
          <volist name="shop_list" id="v" empty="暂时没有店铺，赶紧进行招商吧">
            <tr data-id="{$v.id}" data-name="{$v.name}">
             <td>{$v.id}</td>
             <td><img src="__DATA__/{$v.logo}" class="img_1"/></td>
             <td>{$v.name}</td>
             <td>{$v.level_name}</td>
             <td>{$v.uname}</td>
             <td><a href="javascript:void(0);" title="{$v.address_xq}">{$v.province}</a></td>
             <td><if condition="$v.type eq 1"><font style="color:#c00">是</font><else />否</if></td>
             <td class="obj_1">
              <input type='button' name='choose' value="选 择" class="aaa_pts_web_3" style="margin:3px 0;" onclick="window_opener(this)" id="choose">
             </td>
            </tr>
          </volist>
         <!-- 遍历 -->
         </tbody>
         <tr>
            <td colspan="10" class="td_2">
              {$page}   
            </td>
         </tr>
      </table>      
    </div>
    
</div>
<script>
function product_option(page){
  $('form').submit();
}

//选择返回
function window_opener(e){
  var obj=$(e);
  window.opener.document.getElementById('shop_id').value=obj.parent().parent().attr('data-id');
  window.opener.document.getElementById('shop_name').value=obj.parent().parent().attr('data-name');
  
  window.close();
}

//区域选择
function aaa_china_city_ajax(id,obj_id){
   $('#district').html('<option value="">区</option>');
   $.ajax({
		 url:'{:U("get_city")}',
		 type:'GET',
		 timeout:30000,
		 data:{'id':id},
		 dataType:"json",
		 error: function(){
			$('#loding').hide();
			alert('请求失败，请检查网络');
		 },
		 success:function(data){
			var text=obj_id=='city' ? '<option value="">城市</option>' : '<option value="">区</option>';
			$.each(data,function (a,b){
				text+='<option value="'+b.id+'">'+b.name+'</option>';
			});
			$('#'+obj_id).html(text);
		 }
	 });
}
</script>
</body>
</html>
